package com.dataseek.iot.mysql.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dataseek.iot.mysql.entity.Product;
import com.dataseek.iot.mysql.mapper.ProductMapper;
import com.dataseek.iot.mysql.service.IProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cc
 * @since 2021-09-15
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {


    /**
     * 根据编码查询产品
     * @param code
     * @return
     */
    public Product getProductByCode(String code){
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("product_code", code);
        return this.getOne(wrapper);
    }
}
